/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.edu.fatec.ads.classes;

import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;

/**
 * 
 * @author BRUNO
 */
@Entity
@DiscriminatorValue("1")
public class Predio extends Local{

    private List<Andar> andares;

    //Construtor Padrao
    public Predio() {
        super(1);
    }

    public Predio(int codigo){
        super(codigo, 1);
    }

    /**
     * @return the andares
     */
    @OneToMany(mappedBy="predio", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    public List<Andar> getAndares() {
        return andares;
    }

    /**
     * @param andares the andares to set
     */
    public void setAndares(List<Andar> andares) {
        this.andares = andares;
    }

    @Override
    public String toString() {
        return "Predio[codigo=" + super.getCodigo() +
                        ", nome=" + super.getNome() +
                        ", numero=" + super.getNumero() + "]";
    }

}